/**
 * Created by chenke on 2017/5/17.
 */
var myMoudle = angular.module("logPCapp",[]);
myMoudle.controller("logPCctr",function($scope){
    $scope.logdisNum = true;
    var logdisnum1 = true;var logdisnum2 = true;var logdisnum3 = true;
    var logdisnum4 = true;var logdisnum5 = true;var logdisnum6 = true;
    //监控账号输入框
    $scope.$watch('logusername',function(body){
        if(body){
            var reg = /^1[34578]\d{9}$/;
            var user = reg.test($scope.logusername);
            if(user){
                $scope.logngcolor1 ="greencolor";
                logdisnum1 = false
            }else{
                $scope.logngcolor1 = "redcolor";
                logdisnum1 = true
            }
            $scope.logdisNum = logbtnuse(logdisnum1,logdisnum2);
        }
    });
    //密码输入框的监视
    $scope.$watch('loguserpass',function(body){
        if(body){
            var reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{6,20}$/;  //密码必须有大小写字母和数字且6-20位
            var pass = reg.test($scope.loguserpass);
            if(pass){
                $scope.logngcolor2 = "greencolor";
                logdisnum2 = false
            }else{
                $scope.logngcolor2 = "redcolor";
                logdisnum2 = true
            }
            $scope.logdisNum = logbtnuse(logdisnum1,logdisnum2);
        }
    });

    //注册按钮的可用性判断函数
    function logbtnuse(a1,a2){
        if(a1 == false && a2 == false){
            return false
        }else{
            return true
        }
    }
});































